#!/usr/bin/env python
# encoding: utf-8

print "fr_cwsynonyms"

# built-in stuff
import unittest
import os
import re

from fr_cwsynonyms import *

class Fr_CwSynonymsTest(unittest.TestCase):
	
	def setUp(self):
		self.env = {
			"static": {
				"cwSynonyms_labelSeveral" : "%s",
				"cwSynonyms_labelOne" : "",
				"cwSynonyms_noEntryMessage" : "no entry!",
				"cwSynonyms_emptyWordMessage" : "no word!"
			},
			"context": {}
		}
	
	def testNormal(self):
		self.env["context"]["selection"] = u"décoction"
		self.assertEqual(", ".join(dict(main(self.env))["listBox"]["items"]),u"boisson, bouillie, décocté, digestion, drogue, infusion, macération, philtre, tisane")
	
	def testFollowedBySpace(self):
		self.env["context"]["selection"] = u"décocté "
		self.assertEqual(", ".join(dict(main(self.env))["listBox"]["items"]),u"décoction , tisane ")
	
	def testNoEntry(self):
		self.env["context"]["selection"] = "no entry!"
		self.assertEqual(dict(main(self.env))["messageBox"],'no entry!')
	
	def testNoWord(self):
		self.env["context"]["selection"] = " "
		self.assertEqual(dict(main(self.env))["messageBox"],'no word!')
	

if __name__ == '__main__':
	unittest.main()


